{% extends "servis/base.html" %}

{%block title %}
Nový soubor oprav
{%endblock %}

{%block scripts %}
x=3;
$(document).ready(function () {
$("input#pridatSelect").click(pridejSelect);
});
function pridejSelect(){
	$("div#polozky").append("<p> <select name=\"" + x + "\">{% for p  in sazebnik %}<option 	value='{{p.id}}'>{{p.nazev_ukonu}}</option> {%	endfor %} </select></p>"); 
	$("div#hid").html( "<input type=\"hidden\" name=\"pocetSelectu\" value=\"" + x + "\"/> ");
	x= x+1;
}
   
{%endblock %}

{%block content %}
		<h3>Nový soubor oprav</h3>
		<div id="zpravy"></div>
		<form action="/servis/soubory-oprav/novy/pridat/" method="post" name="pridavaniSouboruoprav" >
			<table>
				<tr>
					<td>Název</td>
				       	<td>
							*<input type="text" name="nazev" />
					</td>
				</tr>
				

				<tr>
					<td >Oprava ze sazebníku</td>
					<td>
					<input type="button" id="pridatSelect" value="Přidej položku" />
					</td>
				</tr>
			</table>
			<div id="polozky">
						<p><select	name="1">
					    		{% for p in sazebnik %}	
								<option value="{{p.id}}">{{p.nazev_ukonu}}</option>
							{% endfor %}
						</select>
</p><p>
						<select	name="2">
					    		{% for p in sazebnik %}	
								<option value="{{p.id}}">{{p.nazev_ukonu}}</option>
							{% endfor %}
						</select>
						</p>
			</div>
				<table>
				<tr>
					<td>* ~ povinné vyplnit</td>

				       	<td> 
						<input type="submit" value="Přidat soubor oprav"/>
					</td>
				</tr>
		</table>	
<div id="hid">
		<input type="hidden" name="pocetSelectu" value="2"/>
</div>
	</form>



{%endblock content %}
